import { BasicColumn, FormSchema } from '@/components/Table';
import { h, ref } from 'vue';
import { Tag } from 'ant-design-vue';
import { ywUserSelectList } from '@/api/heng/ywManage';
import { ApiSelect } from '@/components/Form';
import util from '@/utils/util';

import { useMessage } from '@/hooks/web/useMessage';
import Ainput from '@/views/bookManage/components/account/Ainput.vue';
import { VxeFormItemProps, VxeGridPropTypes } from '@/components/VxeTable';
import { style } from '@logicflow/extension/es/bpmn-elements/presets/icons';

type CheckedType = boolean | string | number;
// BasicColumn[]

// VxeColumnPropTypes.CellRender

/**
 */
export const vxeTableColumns: VxeGridPropTypes.Columns = [
  {
    title: '采购单号',
    field: 'orderNo',
    showOverflow: 'title',
    width: 220,
  },
  {
    title: 'inquiryCode',
    field: 'inquiryCode',
    showOverflow: 'title',
    width: 100,
  },

  {
    title: '查询状态',
    field: 'inquiryStatus',
    showOverflow: 'title',
    align: 'center',
    width: 120,
    slots: {
      default: 'inquiryStatus_slot',
    },
  },
  {
    title: '查询结果',
    field: 'remark',
    showOverflow: 'title',
    align: 'center',
  },
  {
    title: '类型',
    field: 'type',
    align: 'center',
    width: 100,
  },
  {
    title: 'orderCode',
    field: 'orderCode',
    align: 'center',
    width: 100,
  },
  {
    title: 'orderStatus',
    field: 'orderStatus',
    showOverflow: 'title',
    align: 'center',
    width: 120,
  },
  {
    title: 'http请求参数',
    field: 'parameter',
    align: 'center',
    width: 100,
  },
  {
    title: '备注',
    field: 'note',
    align: 'center',
    width: 100,
  },
  {
    title: '创建时间',
    field: 'createTime',
    align: 'center',
    width: 180,
  },
  {
    width: 230,
    title: '操作',
    align: 'center',
    field: '',
    slots: { default: 'action' },
    fixed: 'right',
  },
];

export const componentColumns2: VxeGridPropTypes.Columns = [
  {
    title: 'dkn组件物料编号',
    field: 'component_reference',
    align: 'center',
  },

  {
    title: '数量',
    field: 'quantity',
    width: 80,
    align: 'center',
  },
  {
    title: 'incoterm',
    field: 'incoterm',
    align: 'center',
  },
  {
    title: '迪卡侬供应商编号',
    width: 80,
    field: 'provider_cnuf',
    align: 'center',
  },

  {
    title: '备注',
    field: 'comment',
    align: 'center',
    width: 80,
  },
];

export const componentColumns: VxeGridPropTypes.Columns = [
  {
    title: 'line_number',
    field: 'line_number',
    align: 'center',
    width: 50,
  },
  {
    title: 'ms物料编号',
    field: 'mtid',
    align: 'center',
    width: 80,
    slots: {
      default: 'mtid_slot',
    },
  },
  {
    title: 'dkn组件物料编号',
    field: 'component_reference',
    width: 80,
    align: 'center',
  },
  {
    title: '物料详情',
    field: 'component_description',
    align: 'center',
  },
  {
    title: '迪卡侬物料名称',
    field: 'item_name',
    width: 120,
    align: 'center',
  },
  {
    title: '数量',
    field: 'quantity',
    width: 80,
    align: 'center',
  },
  {
    title: 'incoterm',
    field: 'incoterm',
    width: 80,
    align: 'center',
  },
  {
    title: '迪卡侬供应商编号',
    width: 80,
    field: 'provider_cnuf',
    align: 'center',
  },

  {
    title: '备注',
    field: 'comment',
    align: 'center',
    width: 80,
  },
  {
    width: 150,
    title: '操作',
    align: 'center',
    field: '',
    slots: { default: 'action' },
    fixed: 'right',
  },
];

export const labelColumns: VxeGridPropTypes.Columns = [
  {
    title: 'finished_good_item_code',
    field: 'finished_good_item_code',
    align: 'center',
  },
  {
    title: 'conception_code',
    field: 'conception_code',
    align: 'center',
  },
  {
    title: '数量',
    field: 'quantity',
    align: 'center',
  },
  {
    title: 'incoterm',
    field: 'incoterm',
    align: 'center',
  },
  {
    title: 'provider_cnuf',
    field: 'provider_cnuf',
    align: 'center',
  },
  {
    title: 'shipment_method',
    field: 'shipment_method',
    align: 'center',
  },
  {
    title: '备注',
    field: 'comment',
    align: 'center',
  },
];

export const vxeTableFormSchema: VxeFormItemProps[] = [
  {
    span: 5,
    field: 'keyword',
    title: '查询',
    itemRender: {
      props: {
        placeholder: '查询',
      },
      name: 'AInput',
    },
  },

  {
    span: 5,
    itemRender: {
      name: 'VxeButtonGroup',
      options: [
        { type: 'reset', content: '重置' },
        { type: 'submit', content: '查询', status: 'primary' },
      ],
    },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'orderCode',
    label: 'orderCode',
    component: 'Input',
    required: true,
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'line_number',
    label: 'line_number',
    component: 'Input',
    required: true,
    componentProps: {
      disabled: true,
    },
  },
  // {
  //   field: 'requested_ship_date',
  //   label: '交期',
  //   component: 'DatePicker',
  //   required: true,
  //   componentProps: {
  //     placeholder: '格式yyyy-MM-dd',
  //     valueFormat: 'YYYY-MM-DD',
  //     format: 'YYYY-MM-DD',
  //   },
  // },
  {
    field: 'quantity',
    label: '数量',
    component: 'Input',
    required: true,
  },
  {
    field: 'conception_code',
    label: 'conception_code',
    component: 'Input',
    required: false,
  },
  {
    field: 'comment',
    label: '备注',
    component: 'Input',
    required: false,
  },
];
